<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>欢迎注册</title>
  <!-- <link href="css/register.css" rel="stylesheet"> -->
  <link rel="stylesheet" href="../../style/login/register.css">
  <script type="text/javascript" src="../../plugins/axios/axios.js"></script>
  <script type="text/javascript" src="../../plugins/vue/vue.js"></script>
  <script type="text/javascript" src="../../plugins/jQuery/jquery-3.6.0.js"></script>
  <script type="text/javascript" src="../../plugins/layer-master/dist/layer.js"></script>

  <link rel="stylesheet" href="../../plugins/element-ui/index.css">
  <!-- 引入组件库 -->
  <script src="../../plugins/element-ui/index.js"></script>
</head>
<body>
<div id="app">
  <div class="form-div">
    <div class="reg-content">
      <h1>注册</h1>
      <span>已有帐号？</span> <a href="../login/login.html">登录</a>
    </div>
    <form id="reg-form" action="#" method="post">

      <table>
        <tr>
          <td>用户名</td>
          <td class="inputs">
            <input name="yisXingming" type="text" id="yisXingming" v-model="yisXingming">
          </td>
        </tr>

        <tr>
          <td>账号</td>
          <td class="inputs">
            <input name="yisZhanghao" type="text" id="yisZhanghao" v-model="yisZhanghao">
          </td>
        </tr>
        <tr>
          <td>密码</td>
          <td class="inputs">
            <input name="yisMima" type="text" id="yisMima" v-model="yisMima">
          </td>
        </tr>
        <tr>
          <td>职称</td>
          <td class="inputs">
            <input name="yisZhicheng" type="text" id="yisZhicheng" v-model="yisZhicheng">
          </td>
        </tr>
        <tr>
          <td>科室</td>
          <td class="inputs">
            <input name="yisKeShi" type="text" id="yisKeShi" v-model="yisKeShi">
          </td>
        </tr>
      </table>
      <div class="buttons">
        <input value="注 册" type="button" id="reg_btn" @click="registerIn">
      </div>
      <br class="clear">
    </form>
  </div>
</div>


</body>
</html>
<script>
  new Vue({
    el: "#app",
    date: {
      yisXingming: '',
      yisZhanghao: '',
      yisMima: '',
      yisZhicheng: '',
      yisKeShi: ''
    },
    methods: {
      registerIn() {
        axios({
          url: 'http://localhost:8899/yis/add',
          method: 'get',
          params: {
            yisXingming: this.yisXingming,
            yisZhanghao: this.yisZhanghao,
            yisMima: this.yisMima,
            yisZhicheng: this.yisZhicheng,
            yisKeshi: this.yisKeShi
          }
        }).then(resp => {
          let result = resp.data
          if (result.success) {
            localStorage.setItem('id', resp.data)
            location.href = '../login/login.html'
            return;
          }
          this.error = result.error
        })
      }
    }
  })

</script>